package org.t411.api.scrapper;

import java.io.InputStream;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;

public class DownloadTorrentTask extends HttpAsyncTask<Integer, InputStream> {
	public static final String downloadUrl = "http://www.t411.me/torrents/download/?id=";

	@Override
	protected InputStream doInBackground(Integer... arg0) {
		Integer targetId = arg0[0];
		
		HttpGet dlRequest = new HttpGet(downloadUrl+targetId);
		try {
			HttpResponse dlResponse = browser.execute(dlRequest);
			return getUngzipedInputStream(dlResponse);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}

}
